package com.zxx.pattern.visitorPattern;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.zxx.designpattern.R;
import com.zxx.injectandroid.SimpleDagger;
import com.zxx.libinject.anno.ViewInjector;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

/**
 * @author zxx on 2021/5/10
 */
public class TestInjectFragment extends Fragment {

    @ViewInjector(R.id.fragment_tv)
    TextView textView;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);

        SimpleDagger.inject(this, rootView);

        if (textView != null) {
            Log.e("Tag-->", "### my textview in fragment:" + textView.getText());
        }
        return rootView;
    }
}
